'''
This script cleans-up the data that was created as result of running
the simulation process.

@author: Hatem Oraby
'''

import os
from sys import argv
from shutil import rmtree

def main():
    if len(argv) != 1:
        numberOfPeers = int(argv[1])
    else:
        numberOfPeers = 100
    
    rmDir("Tracker")
    rmDir("Seeder")
    pathName = "Leecher"
    for i in range(numberOfPeers):
        rmDir(pathName + str(i))

def rmDir(pathName):
    fullName = os.path.realpath(".") + "/" + pathName
    fullName = os.path.normpath(fullName)
    #print fullName
    try:
        rmtree(fullName)
        print "Deleted " + fullName
    except OSError,e:
        pass

if __name__ == '__main__':
    main()